import axios from 'common/js/token/request'
//获取账号信息
export function MyAccount() {
  return axios.get('/api/Accounts/MyProfile', {
  }).then((response) => {
    return Promise.resolve(response.data)
  })
    .catch(function (error) {
      console.log(error)
    })
}
//获取获利总金额
export function GetTotalRebate() {
  return axios.get('/api/Orders/cashback/transferredOrders/totalRebate', {
  }).then((response) => {
    return Promise.resolve(response.data)
  })
    .catch(function (error) {
      console.log(error)
    })
}
//修改邮箱
export function UpPaypalAccount(paypalAccount,password) {
  let data ={
    newPaypalAccount:paypalAccount,
    password:password
  }
  return axios.put('/api/Accounts/PaypalAccount',data).then((response) => {
    return Promise.resolve(response.data)
  })
    .catch(function (error) {

      console.log(error)
    })
}
//修改密码
export function UpdateAccountPwd(data) {
  return axios.put('/api/Accounts/pwd',data).then((response) => {
    return Promise.resolve(response.data)
  })
    .catch(function (error) {
      console.log(error)
    })
}
//已转账的订单信息
export function TransferredOrders(PageNumber) {
  return axios.get('/api/Orders/cashback/transferredOrders', {
    params: {
      PageNumber:PageNumber,
      PageSize: 10,
    }
  }).then((response) => {
    return Promise.resolve(response.data)
  })
    .catch(function (error) {
      console.log(error)
    })
}
